Repository navigation
Output modes: declared on the card, accepted by a request, seen by the worker - #67
Merged
Merged
Conversation
…pplication, and the modes a request accepts handed to the worker (accepted_output_modes)
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Media-type validation currently permits case-variant duplicates and non-ASCII names.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds configurable card media modes and forwards client-accepted output modes to workers.
Changes:
- Validates and publishes default input/output modes.
- Propagates
acceptedOutputModesfor send and streaming requests. - Documents and tests output-mode behavior.
| File | Description |
|---|---|
fasta2a/applications.py |
Adds configurable, validated default modes. |
fasta2a/task_manager.py |
Forwards accepted modes to workers. |
fasta2a/schema.py |
Extends internal task parameters. |
README.md |
Documents output-mode usage. |
tests/test_output_modes.py |
Tests declarations, validation, and propagation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for mode in declared: | ||
| if not isinstance(mode, str) or not _MEDIA_TYPE.fullmatch(mode): | ||
| raise ValueError(f'{name}: {mode!r} is not a media type (type/subtype).') | ||
| if len(set(declared)) != len(declared): |
| return declared | ||
|
|
||
|
|
||
| _MEDIA_TYPE = re.compile(r'[a-z0-9][a-z0-9!#$&^_.+-]*/[a-z0-9][a-z0-9!#$&^_.+-]*', re.IGNORECASE) |
… case-insensitive), and the check is ASCII only (no Unicode case folding into [a-z])
…copied as they are both ways; ListTasks reads its status filter as a TaskState
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

FastA2A(default_input_modes=..., default_output_modes=...): the card's default modes, said by the application instead of the fixedapplication/json(still the default when unsaid). A mode that is not a media type (type/subtype), an empty list, a repeated mode or a bare string is refused when the application is made.acceptedOutputModesfrom a request's configuration (fasta2a's names and A2A 1.0's alike) is handed to the worker in its task's params asaccepted_output_modes, formessage/sendandmessage/stream; absent when the client named none.tests/test_output_modes.py.Released as 2.2.0 once merged.